{extend name="public:base" /}

{block name="css"}
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/css/select2.min.css" rel="stylesheet"/>
{/block}

{block name="content"}

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <form method="post">

                        <div class="box-item">
                            <div class="row">
                                <label class="col-sm-1 col-form-label">认证类型</label>
                                <div class="col-lg-3">
                                    <div class="ibox">
                                        <select class="form-control" name="type" id="type-select">
                                            <option value="0">请选择认证类型</option>
                                            <option value="2">渠道商</option>
                                            <option value="1">供应商</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item channel-box">
                            <div class="row">
                                <label class="col-sm-1 col-form-label">渠道商</label>
                                <div class="col-lg-3">
                                    <div class="ibox">
                                        <select class="form-control col-lg-12" name="channel_ident_id" id="channel-select">
                                            <option value="0">请选择渠道商</option>
                                            {volist name="channel_ident_list" id="vo"}
                                            <option value="{$vo.id}">{$vo.username} / {$vo.mobile}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item supplier-box">
                            <div class="row">
                                <label class="col-sm-1 col-form-label">供应商</label>
                                <div class="col-lg-3">
                                    <div class="ibox">
                                        <select class="form-control col-lg-12" name="supplier_ident_id" id="supplier-select">
                                            <option value="0">请选择供应商</option>
                                            {volist name="supplier_ident_list" id="vo"}
                                            <option value="{$vo.id}">{$vo.username} / {$vo.mobile}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="row">
                                <label class="col-sm-1 col-form-label">用户</label>
                                <div class="col-lg-3">
                                    <div class="ibox">
                                        <select class="form-control col-lg-12" name="user_id" id="user-select">
                                            <option value="0">请选择用户</option>
                                            {volist name="user_list" id="vo"}
                                            <option value="{$vo.id}">{$vo.username} / {$vo.mobile}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                        </div>

                        <input type="hidden" name="id" value="{$info['id']}">

                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-default back-page">返回</button>
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}

{block name='js'}
<script src="__STATIC__/jquery/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script>
<script>
    $('#channel-select').select2()
    $('#supplier-select').select2()
    $('#user-select').select2()

    $(function (){
        $('.channel-box').hide();
        $('.supplier-box').hide();
    })

    $('#type-select').change(function (){
        var type = $(this).val();

        if(type == 1){
            $('.channel-box').hide();
            $('.supplier-box').show();
            $('#channel-select').val(0);
        }else if(type == 2){
            $('.channel-box').show();
            $('.supplier-box').hide();
            $('#supplier-select').val(0);
        }
    })
</script>
{/block}
